package com.duanjc.shiro.utils;

import java.util.Random;

/**
 * [一句话描述该类的功能]
 *
 * @author : [duanjiangcheng]
 * @version : [v1.0]
 * @createTime : [2022/11/29 16:06]
 */

public class SaltUtils {

    /** * 生成salt的静态方法 * @param n * @return */
    public static String getSalt(int n){

        char[] chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()".toCharArray();
        int length=chars.length;
        StringBuilder sb=new StringBuilder();
        for (int i = 0; i < n; i++) {

            char aChar = chars[new Random().nextInt(length)];
            sb.append(aChar);
        }
        return sb.toString();
    }
}
